﻿// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace TYG.Client
{
    using System;
    using System.IO;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;
    using System.Threading.Tasks;
    using DotNetty.Codecs;
    using DotNetty.Handlers.Tls;
    using DotNetty.Transport.Bootstrapping;
    using DotNetty.Transport.Channels;
    using DotNetty.Transport.Channels.Sockets;
    using TYG.Common;
    using DotNetty.Codecs.Protobuf;
    using DotNetty.Buffers;
    using Google.Protobuf;
    using TYG.Proto;

    class Program
    {


        static void Main()
        {
            ClientSdk<TankModel>.Instance.ConnectTCPAsync(TankModel.Parser).Wait();
            ClientSdk<TankModel>.Instance.SendMessageAsync(new TankModel { CA = 1, CG = 2, CR = 3, Pid = 11, Pname = "这个名称", PX = 1, PY = 2, PZ = 1, RX = 1, RY = 2, RZ = 3 }, TankModel.Parser).Wait();
            while (true)
            {
                var input = Console.ReadLine();
                if (input.Contains("s"))
                {
                    ClientSdk<TankModel>.Instance.SendMessageAsync(new TankModel { CA = 1, CG = 2, CR = 3, Pid = 11, Pname = "这个名称", PX = 1, PY = 2, PZ = 1, RX = 1, RY = 2, RZ = 3 }, TankModel.Parser).Wait();

                }
                else if (input.Contains("q"))
                {
                    ClientSdk<HostReponse>.Instance.SendMessageAsync(new HostReponse { ContexName = "1" }, HostReponse.Parser);
                }
                else if (input.Contains("w"))
                {
                    ClientSdk<SendFrameRequest>.Instance.SendMessageAsync(new SendFrameRequest { InputH = 0 }, SendFrameRequest.Parser);
                }
                // Console.ReadKey();

            }
        }
    }
}